﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using NIP.ControlLogic;
using System.Drawing;
namespace NIP
{
    static class Program
    {

        static MainWindow window;
        private static void PathPlanningObject_PathPlanningRobotPositionStatusUpdated(object sender, DynamicControl.Event.PathPlanningPositionUpdateEventArgs args)
        {
            Bitmap current = window.getPicture();
           // Point aPoint = new Point();
            current.SetPixel(Convert.ToInt32( args.CurrentCoor[0]) +200 ,Convert.ToInt32( args.CurrentCoor[1]),Color.Red);
            window.setPicture(current);
        }


        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            var controlLogic = new BasicMoveControlLogic();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            window =  new MainWindow();
            window.ControlEvent += controlLogic.Robot_CommandRecognized;
            window.drawEvent += controlLogic.OnContourReadyDrawEvent;
            window.getCurrentEvent += controlLogic.GetCurrent;
            Application.Run(window);
            controlLogic.visionObject.ContourReadyDrawEvent += new EventHandler<VisionSharp.DrawEventArgs>(visionObject_ContourReadyDrawEvent);
            controlLogic.robotObject.PathPlanningObject.PathPlanningRobotPositionStatusUpdated += new EventHandler<DynamicControl.Event.PathPlanningPositionUpdateEventArgs>(PathPlanningObject_PathPlanningRobotPositionStatusUpdated);
   

        }

        static void visionObject_ContourReadyDrawEvent(object sender, VisionSharp.DrawEventArgs e)
        {
            window.setPicture(e.image);
        }

    }
}